<?php get_instance()->view('common/header');?>
<body>
<style>
    .item-left {
        position: absolute;
        left: 0;
    }
    .item-left img{height: 5em;width: 5em}
</style>
<div class="">
    <div class="saixuan">
        <a <?php if ($status == 0):?> class="actived" <?php endif;?> href="<?php echo getUrl('order/getServiceList?status=0')?>">全部</a>
        <a <?php if ($status == 3):?> class="actived" <?php endif;?> href="<?php echo getUrl('order/getServiceList?status=3')?>">处理中</a>
        <a <?php if ($status == 2):?> class="actived" <?php endif;?> href="<?php echo getUrl('order/getServiceList?status=2')?>">已处理</a>
        <a <?php if ($status == 4):?> class="actived" <?php endif;?> href="<?php echo getUrl('order/getServiceList?status=4')?>">已拒绝</a>
        <div class="after"></div>
    </div>
<?php if($list):?>
    <div class="list">
        <?php foreach ($list as $v):?>
            <div class="ddstacte">
                <div class="title">
                    <span class="f09 cor6">售后单号：<?php echo $v['code'];?></span>
                    <span class="hongzi f07"><?php echo $v['status_name'];?></span>
                </div>
                <a href="<?php echo getUrl('order/getServiceDetail?service_id='.$v['id'])?>">
                <div class="itemmodel">
                    <div class="hengleft">
                        <div class="item-left">
                            <div class="item-img"><img src="<?php echo $v['icon']?>" ></div>
                        </div>
                        <div class="item-right">
                            <div class="mltitle mb10"><?php echo $v['title']?></div>
                            <div class="heng vCenter">
                                <p class="f08">申请退款金额<span class="hongzi fb f10 ml5">¥<?php echo $v['refund_amount'];?></span></p>

                            </div>
                        </div>
                    </div>
                    <!-- <div class="hengright vCenter mt10">
                        <div class="">
                            <a href="" class="weui-btn_mini borbtn widbtn cbtn">联系平台</a>
                            <a href="" class="weui-btn_mini borbtn widbtn hbtn">联系商家</a>
                        </div>
                    </div> -->
                </div>
                </a>
            </div>
        <?php endforeach;?>
    </div>
    <div class="weui-loadmore" style="display: none">
        <div class="load">
            <i class="weui-loading"></i>
            <span class="weui-loadmore__tips">正在加载</span>
        </div>
        <span class="noC" style="display: none">没有更多内容了~</span>
    </div>
<?php else:?>
    <div class="statebox chuizhi jdjz" style="flex: 1;height: 100%;">
        <img class="stateimgda mb5" src="<?php echo $this->staticUrl?>img/default/5.png" alt="">
        <span class="f09 cor9 tc mb20">你还没有售后订单哦！</span>
    </div>
<?php endif;?>
</div>
</body>
<script src="<?php echo $this->staticUrl?>js/jquery-weui.js"></script>
<script src="<?php echo $this->staticUrl?>js/base.js"></script>
<script type="text/javascript">
    $(function () {
        /**
         * 上拉加载数据
         */
        var page = 1,
            status = "<?php echo $status?>";

        var loading = false;  //状态标记
        $(document.body).infinite().on("infinite", function() {
            if(loading) return;
            loading = true;
            $(".weui-loadmore").show();
            $(".load").show();
            $(".noC").hide();
            var sUrl = "<?php echo getUrl('order/getServiceDetail?service_id=')?>";
            $.ajax('<?php echo getUrl('order/ajaxGetServiceList');?>', {
                type:'post',
                data:{page:page,status:status},
                dataType:'json',
                error:function(){
                    show_message({status:0, message:'请求超时'});
                },
                timeout:60000,
                success:function(e){
                    loading = false;
                    if (e.status == 0){
                        show_message(e);
                        return;
                    }

                    if (!e.data.length){
                        $(document.body).destroyInfinite();
                        $(".load").hide();
                        $(".noC").show();
                        return;
                    }
                    page += 1;
                    $(".weui-loadmore").hide();
                    var html;
                    $.each(e.data, function (key, obj) {
                        html =
                            '<div class="ddstacte">' +
                            '   <div class="title">' +
                            '       <span class="f09 cor6">售后单号：'+obj.code+'</span>' +
                            '       <span class="hongzi f07">'+obj.status_name+'</span>' +
                            '   </div>' +
                            '   <a href="'+sUrl+obj.id+'">' +
                            '       <div class="itemmodel">' +
                            '           <div class="hengleft">' +
                            '               <div class="item-left">' +
                            '                   <div class="item-img"><img src="'+obj.icon+'"></div>' +
                            '               </div>' +
                            '               <div class="item-right">' +
                            '                   <div class="mltitle mb10">'+obj.title+'</div>' +
                            '                   <div class="heng vCenter">' +
                            '                       <p class="f08">申请退款金额<span class="hongzi fb f10 ml5">¥'+obj.refund_amount+'</span></p>' +
                            '                   </div>' +
                            '               </div>' +
                            '           </div>' +
                            '       </div>' +
                            '   </a>' +
                            '</div>';
                        $(".list").append(html);
                    });
                }
            });
        });
    })
</script>
</html>